package com.qf.arrayList;

import java.util.ArrayList;

import java.util.Scanner;

public class ArrayListTest02 {

	
	public static void main(String[] args) {
		//泛型就是学生
		ArrayList<Student> arrlist = new ArrayList<Student>();
		
		Student s1 = new Student("小明",1,'男',23);
		
		arrlist.add(s1);
		Student s2 = new Student("小兰",2,'女',24);
		
		arrlist.add(s2);
		Student s3 = new Student("小红",3,'女',20);
		
		arrlist.add(s3);
		
		try (Scanner input = new Scanner(System.in)) {
			int num=input.nextInt();
			
			boolean flag=false;
			for (Student s : arrlist) {
				if(s.getStuId() == num) {
					flag = true;
					break;
				}
			}
			if(flag) {
				//id减一是下标
				System.out.println(arrlist.get(num-1));
				
			}
			else {
				System.out.println("学号不存在！");
			}
		}
		
		
		
	}
}
